import os
import glob

execfile('keplerian_mask.py', globals())
v_src=4.1e3

inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=1.25
r_min=0.1
r_max=0.3
zr=0.2


os.system('rm -rf V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask-hdo.image')
## 225 GHz transition
make_mask(image='V883_Ori_SB_HDO-225.535GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask.image V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask-hdo.image')

exportfits(imagename='V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask-hdo.image',fitsimage='V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask-hdo.fits')

#CH3OHCO
nu_hdo=225.89672e9
nu_ch3ocho=225.90074e9
v_shift=(nu_ch3ocho- nu_hdo)/nu_hdo*3.0e8
v_src_shift=v_src-v_shift

os.system('rm -rf V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask-ch3ocho.image')
make_mask(image='V883_Ori_SB_HDO-225.535GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src_shift,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask.image V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask-ch3ocho.image')

exportfits(imagename='V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask-ch3ocho.image',fitsimage='V883_Ori_SB_HDO-225.535GHz_robust_2.0.mask-ch3ocho.fits')


v_src=3.8e3
inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=0.5
r_min=0.1
r_max=0.3
zr=0.2
dV0=600.0
dVq=0.0

##241 GHz transition

os.system('rm -rf V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-3.8kms.image')

make_mask(image='V883_Ori_SB_HDO-241.558GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-3.8kms.image')

os.system('rm -rf V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-3.5kms.image')
make_mask(image='V883_Ori_SB_HDO-241.558GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=3.5e3,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-3.5kms.image')
os.system('rm -rf  V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-4.1kms.image')
make_mask(image='V883_Ori_SB_HDO-241.558GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=4.1e3,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-4.1kms.image')

os.system('rm -rf  V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-4.5kms.image')
make_mask(image='V883_Ori_SB_HDO-241.558GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=4.5e3,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-4.5kms.image')


immath(imagename=['V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-3.5kms.image','V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-4.5kms.image'],
expr='iif(IM0==1,1.0,IM1)',outfile='V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-3.5-4.5.image')

exportfits(imagename='V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-3.5-4.5.image',fitsimage='V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-hdo-3.5-4.5.fits')

#Acetaldehyde CH3CHO
nu_hdo=241.56155e9
nu_ch3cho=241.56299e9

v_shift=(nu_ch3cho- nu_hdo)/nu_hdo*3.0e8
v_src_shift=v_src-v_shift

v_src_shift=1.55e3+4.1e3

v_src=1.5e3
inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=0.5
r_min=0.1
r_max=0.2
zr=0.2
dV0=600.0
dVq=0.0


os.system('rm -rf V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-ch3cho.image')

make_mask(image='V883_Ori_SB_HDO-241.558GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-ch3cho.image')

exportfits(imagename='V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-ch3cho.image',fitsimage='V883_Ori_SB_HDO-241.558GHz_robust_2.0.mask-ch3cho.fits')

#HDO again- convolved to H218O beam


v_src=4.1e3

inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=1.25
r_min=0.1
r_max=0.3
zr=0.2


os.system('rm -rf V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask-hdo.image')
## 225 GHz transition
make_mask(image='V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask.image V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask-hdo.image')

exportfits(imagename='V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask-hdo.image',fitsimage='V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask-hdo.fits')

#CH3OHCO
nu_hdo=225.89672e9
nu_ch3ocho=225.90074e9
v_shift=(nu_ch3ocho- nu_hdo)/nu_hdo*3.0e8
v_src_shift=v_src-v_shift

os.system('rm -rf V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask-ch3ocho.image')
make_mask(image='V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src_shift,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask.image V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask-ch3ocho.image')

exportfits(imagename='V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask-ch3ocho.image',fitsimage='V883_Ori_SB_HDO-225.535GHz-bm_match_H218O_robust_2.0.mask-ch3ocho.fits')


v_src=3.8e3
inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=0.5
r_min=0.1
r_max=0.3
zr=0.2
dV0=600.0
dVq=0.0

##241 GHz transition

os.system('rm -rf V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-3.8kms.image')

make_mask(image='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-3.8kms.image')

os.system('rm -rf V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-3.5kms.image')
make_mask(image='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=3.5e3,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-3.5kms.image')
os.system('rm -rf  V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-4.1kms.image')
make_mask(image='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=4.1e3,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-4.1kms.image')

os.system('rm -rf  V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-4.5kms.image')
make_mask(image='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=4.5e3,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-4.5kms.image')


immath(imagename=['V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-3.5kms.image','V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-4.5kms.image'],
expr='iif(IM0==1,1.0,IM1)',outfile='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-3.5-4.5.image')

exportfits(imagename='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-3.5-4.5.image',fitsimage='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-hdo-3.5-4.5.fits')

#Acetaldehyde CH3CHO
nu_hdo=241.56155e9
nu_ch3cho=241.56299e9

v_shift=(nu_ch3cho- nu_hdo)/nu_hdo*3.0e8
v_src_shift=v_src-v_shift

v_src_shift=1.55e3+4.1e3

v_src=1.5e3
inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=0.5
r_min=0.1
r_max=0.2
zr=0.2
dV0=600.0
dVq=0.0


os.system('rm -rf V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-ch3cho.image')

make_mask(image='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask.image V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-ch3cho.image')

exportfits(imagename='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-ch3cho.image',fitsimage='V883_Ori_SB_HDO-241.558GHz-bm_match_H218O_robust_2.0.mask-ch3cho.fits')



#### H2CO

v_src=4.3e3

inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=1.75
r_min=0.05
r_max=0.9
zr=0.2
dV0=1000.0
dVq=0.0

os.system('rm -rf V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co.image')

make_mask(image='V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co.image')

exportfits(imagename='V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co.image',fitsimage='V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co.fits',overwrite=True)

v_src=4.6e3
os.system('rm -rf V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.6.image')
make_mask(image='V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.6.image')


v_src=4.0e3
os.system('rm -rf V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.0.image')
make_mask(image='V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.0.image')


os.system('rm -rf V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.0-4.6.image')
immath(imagename=['V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.0.image','V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.6.image'],
expr='iif(IM0==1,1.0,IM1)',outfile='V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.0-4.6.image')

exportfits(imagename='V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.0-4.6.image',fitsimage='V883_Ori_SB_H2CO-225.694GHz-fullcube_robust_2.0.mask-h2co-4.0-4.6.fits',overwrite=True)


#### C17O

v_src=4.3e3

inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=1.25
r_min=0.05
r_max=0.85
zr=0.2
dV0=1200.0
dVq=0.0

os.system('rm -rf V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o.image')

make_mask(image='V883_Ori_SB_C17O-224.711GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask.image V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o.image')

exportfits(imagename='V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o.image',fitsimage='V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o.fits',overwrite=True)

v_src=4.6e3
os.system('rm -rf V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-4.6.image')

make_mask(image='V883_Ori_SB_C17O-224.711GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask.image V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-4.6.image')

v_src=3.7e3
os.system('rm -rf V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-3.7.image')

make_mask(image='V883_Ori_SB_C17O-224.711GHz_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask.image V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-3.7.image')

os.system('rm -rf V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-3.7-4.6.image')
immath(imagename=['V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-3.7.image','V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-4.6.image'],
expr='iif(IM0==1,1.0,IM1)',outfile='V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-3.7-4.6.image')

exportfits(imagename='V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-3.7-4.6.image',fitsimage='V883_Ori_SB_C17O-224.711GHz_robust_2.0.mask-c17o-3.7-4.6.fits',overwrite=True)

#### CH3OH

v_src=-6.3e3

inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=1.75
r_min=0.05
r_max=0.5
zr=0.2
dV0=1000.0
dVq=0.0

os.system('rm -rf V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh.image')

make_mask(image='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh.image')

exportfits(imagename='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh.image',fitsimage='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh.fits',overwrite=True)


v_src=-50.2e3
line='241.887'
os.system('rm -rf V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')

make_mask(image='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')
exportfits(imagename='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image',fitsimage='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.fits',overwrite=True)

v_src=-39.3e3
line='241.879'
os.system('rm -rf V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')

make_mask(image='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')
exportfits(imagename='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image',fitsimage='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.fits',overwrite=True)



v_src=-6.3e3
line='241.852'
os.system('rm -rf V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')

make_mask(image='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')
exportfits(imagename='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image',fitsimage='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.fits',overwrite=True)


v_src=41.8e3
line='241.813'
os.system('rm -rf V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')

make_mask(image='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')
exportfits(imagename='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image',fitsimage='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.fits',overwrite=True)


v_src=50.3e3
line='241.806'
os.system('rm -rf V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')

make_mask(image='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr,dV0=dV0,dVq=dVq) 
os.system('mv V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask.image/ V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image')
exportfits(imagename='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.image',fitsimage='V883_Ori_SB_CH3OH-241.846GHz-fullcube_robust_2.0.mask-ch3oh-'+line+'.fits',overwrite=True)



 ### H218O
v_src=4.8e3

inc=38.3
PA=32.0
mstar=0.75
dist=400.0
nbeams=0.25
r_min=0.1
r_max=0.25
zr=0.2
dV0=000.0
dVq=0.0

os.system('rm -rf V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask.image V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-h218o.image')
## 225 GHz transition
make_mask(image='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask.image V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-h218o.image')
exportfits(imagename='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-h218o.image',fitsimage='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-h218o.fits',overwrite=True)

 ### CH3OCH3 blue
v_src=4.25e3-3.8e3

inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=0.65
r_min=0.1
r_max=0.25
zr=0.2
dV0=600.0
dVq=0.0

os.system('rm -rf V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask.image V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_blue.image')
## 225 GHz transition
make_mask(image='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask.image V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_blue.image')
exportfits(imagename='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_blue.image',fitsimage='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_blue.fits',overwrite=True)

 ### CH3OCH3 blue 2
v_src=4.25e3-5.76e3

inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=0.65
r_min=0.1
r_max=0.25
zr=0.2
dV0=600.0
dVq=0.0

os.system('rm -rf V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask.image V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_blue2.image')
## 225 GHz transition
make_mask(image='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask.image V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_blue2.image')
exportfits(imagename='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_blue2.image',fitsimage='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_blue2.fits',overwrite=True)


 ### CH3OCH3 red
v_src=4.25e3+7.0e3

inc=38.3
PA=32.0
mstar=1.285
dist=400.0
nbeams=0.65
r_min=0.1
r_max=0.25
zr=0.2
dV0=600.0
dVq=0.0

os.system('rm -rf V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask.image V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-h218o.image')
## 225 GHz transition
make_mask(image='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.image',\
          inc=inc,PA=PA,mstar=mstar,dist=dist,vlsr=v_src,nbeams=nbeams,\
          r_min=r_min,r_max=r_max,zr=zr) 
os.system('mv V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask.image V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_red.image')
exportfits(imagename='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_red.image',fitsimage='V883_Ori_SB_H218O-203.GHz-0.4kms_robust_2.0.mask-ch3och3_red.fits',overwrite=True)


